package com.guigu.www.mapper;

import com.guigu.www.pojo.TemplateWholesomeDetails;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author DengHao
 * @since 2021-10-21
 */
public interface TemplateWholesomeDetailsMapper extends BaseMapper<TemplateWholesomeDetails> {

    @Select("SELECT * FROM template_wholesome_details twd INNER JOIN " +
            "wholesome_inner wi ON twd.`temp_who_de_id`=wi.`temp_who_de_id` " +
            "WHERE wi.`temp_who_id`=#{tempWhoId}\n")
    List<TemplateWholesomeDetails> queryById(int tempWhoId);

    /*陈显科 根据健康干预id查询*/
    @Select("SELECT * FROM template_wholesome_details WHERE temp_who_de_id IN(\n" +
            "SELECT temp_who_de_id  FROM wholesome_inner WHERE temp_who_id=#{wid})")
    List<TemplateWholesomeDetails> selectWid(@Param("wid") int wid);
}
